package com.lzc.springboot.service.impl;

import com.lzc.springboot.domain.Expert;
import com.lzc.springboot.mapper.ExpertMapper;
import com.lzc.springboot.service.ExpertService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class ExpertServiceImpl implements ExpertService {

  @Autowired
  private ExpertMapper expertMapper;

  @Override
  public Expert[] findExpertBySearch(Expert expert) {
    return expertMapper.findExpertBySearch(expert);
  }

  @Override
  public Expert findExpertById(int id) {
    return expertMapper.findExpertById(id);
  }

  @Override
  public Expert[] findAllExpert() {
    return expertMapper.findAllExpert();
  }

  @Override
  public void changeExpert(Expert expert) {
    expertMapper.changeExpert(expert);
  }

  @Override
  public Expert[] findAllUncheckedExpert() {
    return expertMapper.findAllUncheckedExpert();
  }

  @Override
  public Expert[] findUncheckedBySearch(Expert expert) {
    return expertMapper.findUncheckedBySearch(expert);
  }

  @Override
  public Expert findExpertByUid(int uid) {
    return expertMapper.findExpertByUid(uid);
  }

  @Override
  public void changeExpertByExpert(Expert expert) {
    expertMapper.changeExpertByExpert(expert);
  }

  @Override
  public void delExpertById(int id) {
    expertMapper.delExpertById(id);
  }

  @Override
  public void addExpert(Expert expert) {
    expert.setInfo("这个人很懒什么都没有留下");
    expert.setQuestion_count(0);
    expert.setTol_rate(0);
    expert.setEmail(expert.getEmail() + ".com");
    expertMapper.addExpert(expert);
  }
}
